<template>
  <div>
    <el-button @click="createCode">点击生成二维码</el-button>

    <!-- 需求：http://www.baidu.com -->
    <canvas ref="canvas" />

  </div>
</template>
<script>
import Qrcode from 'qrcode'
export default {
  methods: {
    createCode() {
      Qrcode.toCanvas(this.$refs.canvas, 'http://www.baidu.com', { width: 300 })
    }
  }
}
</script>
<style>
</style>
